<script lang="ts" setup>
import { useLayoutMode } from "@@/composables/useLayoutMode"

interface Props {
  collapse?: boolean
}

const { collapse = true } = defineProps<Props>()

const { isLeft, isTop } = useLayoutMode()
</script>

<template>
  <div
    class="layout-logo-container"
    :class="{ 'collapse': collapse, 'layout-mode-top': isTop, 'layout-mode-left': isLeft }"
  >
    <transition name="layout-logo-fade">
      <router-link v-if="collapse" key="collapse" to="/">
        <!-- <img :src="logo" class="layout-logo"> -->
        <SvgIcon name="video" class="layout-logo svg-icon" />
      </router-link>
      <router-link v-else key="expand" to="/">
        <!-- <img :src="!isLeft ? logoText2 : logoText1" class="layout-logo-text"> -->
        <div class="layout-logo-main">
          <!-- <img :src="logo" alt=""> -->
          <SvgIcon name="video" class="svg-icon" />
          <span>Video Admin</span>
        </div>
      </router-link>
    </transition>
  </div>
</template>

<style lang="scss" scoped>
.layout-logo-container {
  position: relative;
  width: 100%;
  height: var(--v3-header-height);
  line-height: var(--v3-header-height);
  text-align: center;
  overflow: hidden;

  .layout-logo {
    display: none;
  }

  .layout-logo-text {
    height: 100%;
    vertical-align: middle;
  }
}

.layout-mode-top {
  height: var(--v3-navigationbar-height);
  line-height: var(--v3-navigationbar-height);
}

.layout-mode-left {
  height: calc(var(--v3-navigationbar-height) + 10px);
  line-height: calc(var(--v3-navigationbar-height) + 10px);
}

.collapse {
  .layout-logo {
    width: 32px;
    height: 32px;
    vertical-align: middle;
    display: inline-block;
  }

  .layout-logo-text,
  .layout-logo-main {
    display: none;
  }
}

.layout-logo-main {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 20px;

  img {
    display: inline-block;
    width: 32px;
    height: 32px;
  }

  span {
    font-size: 20px;
    font-weight: bold;
    color: var(--el-color-primary);
    animation: showup 0.3s linear forwards;
  }
}

.svg-icon {
  font-size: 30px;
  color: var(--el-color-primary);
}

@keyframes showup {
  0% {
    filter: blur(10px);
    letter-spacing: -10px;
  }

  100% {
    filter: blur(0px);
    letter-spacing: 1px;
  }
}
</style>
